package Annoation;

import JUC.Test;

import java.lang.reflect.Field;
import java.lang.reflect.Method;

public class Demo2 {
    public static void main (String[] args) throws Exception{
        Class<Test> clazz = Test.class;
        Test test = clazz.getDeclaredConstructor ().newInstance ();
        Field age = clazz.getDeclaredField ("age");
        age.setAccessible (true);
        age.set (test,100);
        Method getAge = clazz.getDeclaredMethod ("getAge");
        int a=(int)getAge.invoke (test);
        System.out.println (a);
    }
}
